using System;
using System.Collections.Generic;
using System.Text;
using WozLib.UI.Ink.SketchObjects;

namespace WozLib.UI.Ink.SketchCommands
{
  public class UserButtonActionSketchCommand : UserActionSketchCommand
  {

    public UserButtonActionSketchCommand()
      : base()
    {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="wozObject">the button that was pressed</param>
    public UserButtonActionSketchCommand(SketchObject wozObject)
      : base(wozObject)
    {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="wozObjects">the buttons that were pressed</param>
    public UserButtonActionSketchCommand(IEnumerable<SketchObject> wozObjects)
      : base(wozObjects)
    {
    }

    public ButtonSketchObject GetSketchButton()
    {
      ButtonSketchObject button = null;

      foreach (SketchObject sketchObject in this.TargetWozObjects)
      {
        if (sketchObject is ButtonSketchObject)
        {
          return sketchObject as ButtonSketchObject;
        }
      }

      return button;
    }

    public override void Redo()
    {
      if (this.WozClientCommandReferences != null && this.WozClientCommandReferences.InkCanvas != null)
      {
        // for now the server will just see this command in the event stream and extract our button
      }
    }

    public override void Undo()
    {
      // not really anything to undo for this command
    }
  }
}